//- 先去这个pug文件中找
extends ../commons/commons.pug

block append pageStyle
	link(href="${relativePath}/static/css/shopping/shopIndex.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/rightOrder.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/madeProcess.css" rel="stylesheet" type="text/css")

block content
	
	//- 相册/已评论
	div.commentBox
		//- 个人相册
		div.allBox.alumsBox
			ul.ablums.myablums
				//- li
				//- 	img(src="${relativePath}/static/imgs/img01.png")
				//- 	p IMGkenenghuiyoudongxi 
				//- 	div.mask
				//- 		i
	//- 我的个人相册列表
	script#myAlbmList(type="text/html")
		| {{set phones = data.lists}}
		| {{each phones arr}}
		li(id="{{arr.id}}")
			img(src="{{arr.img}}")
			//- p {{arr.add_time}}
			div.mask
				i
		| {{/each}}

	//- 分页
	div.pageBox
		nav.pageNav
			
			div.paginationOne.page


block pageScript

	script.

		$(function() {
			//- 获取我的相册列表
			function myAblums(pageNum) {
				$.post(shopIp+"/user/infoPhoto",{
					userToken:token,
					id:thisRequest.id,
					size:5,
					page:pageNum
				},function(data) {
					var imgs = template("myAlbmList",data);
					if(data.data.lists.length==0) {
						$(".ablums").append("<img class='imgBig' src='${relativePath}/static/imgs/zw.png' style='padding-bottom:200px;'/>");
						$(".ablums").css("text-align","center");
						$(".page").hide()
					}else{
					$(".page").show()
						$(".ablums").append(imgs);
					}
					$(".page").html("").pagination({
						pageCount : data.data.total_page,
						current : pageNum,
						keepShowPN : true,
						count : 2,
						homePage : "1",
						endPage : data.data.total_page,
						coping : true,
						prevContent : "< 上一页",
						nextContent : "下一页 >",
						callback : function(page) {
							myAblums(page.getCurrent());
						}
					});
				})
			}
			myAblums(1);
			//- 鼠标放在个人相册信息
			$(".ablums").on("mouseover","li",function() {
				$(this).children(".mask").show();
			})
			//- 鼠标离开个人相册信息
			$(".ablums").on("mouseleave","li",function() {
				$(this).children(".mask").hide();
			})

			//- 点击删除个人相册
			$(".ablums").on("click",".mask i",function() {
				var $this = $(this);
				if(window.event){//IE下阻止默认事件
		            event.returnValue = false;
		        }else{
		            event.preventDefault();
		        }
				layer.confirm('确定删除此相册？', {
					btn: ['确定','取消'], //按钮
					title: ['删除相册', 'text-align:center;padding:0;']
				}, function(){
					$.post(shopIp+"/user/delphoto",{
						userToken:token,
						id:$this.closest("li").attr("id"),
					},function(data) {
						//console.log(data.msg);
						if(data.status == "200") {
							layer.msg('删除成功', {icon: 1});
							$this.closest("li").remove();
						} else{
							layer.msg(data.msg);
						}
					})
				}, function(){
						//layer.msg('已取消');
				});
			})
		})
		